package com.athena.service.classes;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.athena.api.classes.ISubjectService;
import com.athena.dal.dao.SubjectDao;
import com.athena.dal.entities.Subject;

/**
 * 
 * @author Ajit.Kumar1
 *
 */
@Service("subjectService")
@Scope((BeanDefinition.SCOPE_SINGLETON))
public class SubjectService implements ISubjectService {
	
	@Autowired
	private SubjectDao subjectDao;

	@Override
	public Subject[] getClassCourses(int classId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Subject[] getTeachingCourses(int facultyId, int classId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Subject[] getElectivesbyStudent(int studentId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Subject[] getElectivesbyClass(int classId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Subject> getSubjectsForDept(String departmentId) {
		if(departmentId == null || departmentId.trim().isEmpty()){
			throw new IllegalArgumentException("DepartmentId is either empty or null");
		}
		return subjectDao.findAllSubjectsForDept(departmentId);
	}

	@Override
	public List<Subject> getSubjectsForDeptOfClass(String departmentId, int classId) {
		if(departmentId == null || departmentId.trim().isEmpty()){
			throw new IllegalArgumentException("DepartmentId is either empty or null");
		}
		if(classId < 0){
			throw new IllegalArgumentException("Class Id is negative");
		}
		return subjectDao.findAllSubjectsOfDeptForClass(departmentId, classId);
	}


}
